<%@ Page AutoEventWireup="true" CodeBehind="ImageViewer.aspx.cs" Inherits="Dascoba.Umb.FileManager.Pages.ImageViewer"
    Language="C#" MasterPageFile="../../masterpages/umbracoPage.Master" ValidateRequest="false" %>

<%@ Register Assembly="controls" Namespace="umbraco.uicontrols" TagPrefix="cc1" %>
<asp:Content ContentPlaceHolderID="head" ID="headContent" runat="server">
    <script type="text/javascript">

        $(window).load(function () {
            resizepreview();
        });

        $(window).resize(function () {
            resizepreview();
        });

        function resizepreview() {

            var previewHeight = $(window).height() - <%=this.ViewerOffset %>;
            var imageHeight = $('#<%=imagePreview.ClientID %>').height();

            $('#<%=panel_imagepreview.ClientID %>').height(previewHeight);

            if (imageHeight < previewHeight) {

                var halfPreview = previewHeight / 2;
                var halfImage = imageHeight / 2;
                var imageTop = halfPreview - halfImage;

                $('#<%=imagePreview.ClientID %>').css({ 'position': 'relative', 'top': imageTop });
            }
            $('.tabpagescrollinglayer').css('overflow', 'hidden');
        }

    </script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" ID="bodyContent" runat="server">
    <cc1:TabView ID="tabs_imageviewer" runat="server" />
    <cc1:Pane ID="pane_imagepreview" runat="server" HorizontalAlign="NotSet">
        <asp:Panel BackColor="#666666" BorderStyle="Inset" BorderWidth="1" HorizontalAlign="Center"
            ID="panel_imagepreview" runat="server" ScrollBars="Auto" Style="position: relative;">
            <asp:Image BackColor="Transparent" BorderColor="WhiteSmoke" BorderStyle="Dotted"
                BorderWidth="1" ID="imagePreview" ImageAlign="Middle" runat="server" />
        </asp:Panel>
    </cc1:Pane>
</asp:Content>
